package com.bgamq.boot.entity.service;

import com.bgamq.boot.entity.Dept;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class DeptServiceFactoryFallback implements FallbackFactory<DeptService> {

    @Override
    public DeptService create(Throwable throwable) {
        return new DeptService() {
            @Override
            public boolean add(Dept dept) {
                return false;
            }

            @Override
            public Dept get(Long id) {
                Dept dept = new Dept();
                dept.setDb_source("not database");
                dept.setDname("没有对应的数据");
                dept.setDeptno(id);
                return dept;
            }

            @Override
            public List<Dept> getList() {
                return null;
            }
        };
    }
}
